Image recognition method for detection tasks based on single convolutional neural network and image recognition system thereof

ABSTRACT

An image recognition method, including: obtaining an image to be recognized by an image sensor; inputting the image to be recognized to a single convolutional neural network; obtaining a first feature map of a first detection task and a second feature map of a second detection task according to an output result of the single convolutional neural network, wherein the first feature map and the second feature map have a shared feature; using an end-layer network module to generate a first recognition result corresponding to the first detection task from the image to be recognized according to the first feature map, and to generate a second recognition result corresponding to the second detection task from the image to be recognized according to the second feature map; and outputting the first recognition result corresponding to the first detection task and the second recognition result corresponding to the second detection task.

CROSS-REFERENCE TO RELATED APPLICATION

This application claims the priority benefit of Taiwan application no. 109135458, filed on Oct. 14, 2020. The entirety of the above-mentioned patent application is hereby incorporated by reference herein and made a part of this specification.

TECHNICAL FIELD

The disclosure relates to an image recognition method and an image recognition system.

BACKGROUND

In the field of image recognition, neural networks have been widely used. However, different types of recognitions often require different neural network architectures. Therefore, traditionally, the recognition of multiple features requires the construction of multiple sets of neural networks. How to use a single neural network architecture to recognize multiple features to improve performance is the goal of those skilled in the art.

SUMMARY

The disclosure provides an image recognition method and an image recognition system, which can simultaneously output recognition results corresponding to different detection tasks according to obtained features.

The disclosure provides an image recognition method for a plurality of detection tasks. The image recognition method includes: obtaining an image to be recognized by an image sensor; inputting the image to be recognized to a single convolutional neural network; obtaining a first feature map of a first detection task and a second feature map of a second detection task according to an output result of the single convolutional neural network, wherein the first feature map and the second feature map have a shared feature; using an end-layer network module to generate a first recognition result corresponding to the first detection task from the image to be recognized according to the first feature map, and to generate a second recognition result corresponding to the second detection task from the image to be recognized according to the second feature map; and outputting the first recognition result corresponding to the first detection task and the second recognition result corresponding to the second detection task.

The disclosure provides an image recognition system, which includes an image sensor, a storage device, an output device and a processor. The image sensor obtains an image to be recognized. The processor is coupled to the image sensor, the storage device and the output device. The processor inputs the image to be recognized to a single convolutional neural network. The storage device stores the single convolutional neural network. The processor obtains a first feature map belonging to a first detection task and a second feature map belonging to a second detection task according to an output result of the single convolutional neural network, wherein the first feature map and the second feature map have a shared feature. The processor uses an end-layer network module to generate a first recognition result corresponding to the first detection task from the image to be recognized according to the first feature map, and to generate a second recognition result corresponding to the second detection task from the image to be recognized according to the second feature map. The output device outputs the first recognition result corresponding to the first detection task and the second recognition result corresponding to the second detection task.

Based on the above, the image recognition method and system of the exemplary embodiments of the disclosure can obtain the recognition results of different detection tasks by using the single convolutional neural network.

To make the aforementioned more comprehensible, several embodiments accompanied with drawings are described in detail as follows.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram illustrating an image recognition system according to an exemplary embodiment of the disclosure.

FIG. 2 is a block diagram illustrating an image recognition module based on a single convolutional neural network according to an exemplary embodiment of the disclosure.

FIG. 3 is a schematic diagram illustrating an image preprocessing according to an exemplary embodiment of the disclosure.

FIG. 4 is a schematic diagram illustrating feature maps obtained for different detection tasks according to an exemplary embodiment of the disclosure.

FIG. 5 is a schematic diagram illustrating a grid map obtained by using a computer vision technique according to an exemplary embodiment of the disclosure.

FIG. 6 is a schematic diagram illustrating a first feature map and a second feature map according to an exemplary embodiment of the disclosure.

FIG. 7 is a schematic diagram illustrating inputs for a first loss function according to an exemplary embodiment of the disclosure.

FIG. 8 is a schematic diagram illustrating inputs for a second loss function according to an exemplary embodiment of the disclosure.

FIG. 9A to FIG. 9D are schematic diagrams illustrating a segmentation map obtained by using a computer vision technique according to an exemplary embodiment of the disclosure.

FIG. 10 is a flowchart illustrating an image recognition method according to an exemplary embodiment of the disclosure.

DETAILED DESCRIPTION

FIG. 1 is a block diagram illustrating an image recognition system according to an exemplary embodiment of the disclosure.

Referring to FIG. 1, an image recognition system 100 is configured to execute an image recognition method described in the disclosure, so as to use a single convolutional neural network to obtain recognition results of different detection tasks. The image recognition system 100 may be, for example, a mobile device, a personal digital assistant (PDA), a notebook computer, a tablet computer, a general desktop computer or other electronic device, which is not limited herein.

The image recognition system 100 includes an image sensor 110, a storage device 120, an output device 130 and a processor 140.

The image sensor 110 is configured to obtain an image to be recognized. In this exemplary embodiment, the image sensor 110 is, for example, a camcorder or a camcorder of a camera of a mobile device.

The storage device 120 is configured to store the single convolutional neural network, the image to be recognized and the recognition results. In this exemplary embodiment, the storage device 120 may be, for example, a fixed or a movable device in any possible forms including a random access memory (RAM), a read-only memory (ROM), a flash memory, a hard drive or other similar devices, or a combination of the above-mentioned devices.

The output device 130 is a device or an element configured to output an image recognition result. The output device 130 is, for example, a display. For instance, when the image to be recognized is a road image (e.g., including images of trees, vehicles and pedestrians), the output device 130 can output the images of trees, vehicles and pedestrians in image to be recognized according to the image recognition method of the disclosure.

The processor 140 is coupled to the image sensor 110, the storage device 120 and the output device 130 to control operations of the image recognition system 100. In this exemplary embodiment, the processor 140 is, for example, a processor for general purposes, a processor for special purposes, a conventional processor, a data signal processor, a plurality of microprocessors, one or more microprocessors, controllers, microcontrollers and Application Specific Integrated Circuit (ASIC) which are combined to a core of the digital signal processor, a Field Programmable Gate Array (FPGA), any other integrated circuits, a state machine, a processor based on Advanced RISC Machine (ARM) and similar products.

In this exemplary embodiment, the processor 140 can run an image recognition module based on the single convolutional neural network to perform recognitions of multiple detection tasks at the same time.

FIG. 2 is a block diagram illustrating an image recognition module based on a single convolutional neural network according to an exemplary embodiment of the disclosure.

Referring to FIG. 2, an image recognition module 2000 based on a single convolutional neural network includes an image preprocessing module 2002, a backbone architecture module 2004, an end-layer network module 2006 and a computer vision processing module 2008.

In this exemplary embodiment, the processor 140 runs the image preprocessing module 2002 to perform a preprocessing on the image to be recognized obtained by the image sensor 110.

FIG. 3 is a schematic diagram illustrating an image preprocessing according to an exemplary embodiment of the disclosure.

Referring to FIG. 3, the image preprocessing module 2002 can normalize the length and width dimensions of the image to be recognized (e.g., a raw image 311 or a raw image 321) to the dimensions of the neural network model.

Specifically, it is assumed that the dimensions of the neural network model include a width W_(M) and a height H_(M), as shown by an image padding in an operation 310 in FIG. 3. The image preprocessing module 2002 performs the image padding on the raw image 311 (with a width W_(I) and a height H_(I)) to adjust an aspect ratio of the image to obtain an input image 312.

Further, in another example, as shown by an operation 320 and an operation 330 and Formula 1 below, the image preprocessing module 2002 can also resize the raw image 321 by using a bicubic interpolation to obtain an input image 322. I(u,v)=Σ_(x,y=0) ³ a _(xy) I _(I)(u ^(x) ,v ^(y))  (Formula 1)

Referring to FIG. 2, the backbone architecture module 2004 is configured to extract features of the image to be recognized, and the end-layer network module 2006 is configured to perform multiple detection tasks and recognitions according to feature maps output by the backbone architecture module 2004.

Specifically, the backbone architecture module 2004 is configured with a plurality of convolution layers in the single convolutional neural network, and the processor 140 runs the backbone architecture module 2004 to extract features corresponding to the detection tasks from the image to be recognized, so as to generate the feature maps. Then, the processor 140 runs the end-layer network module 2006 to perform the detection tasks and recognitions.

In this exemplary embodiment, for example, a first detection task is a 2D object detection task, and a second detection task is an image segmentation detection task. Accordingly, the backbone architecture module 2004 outputs a first feature map corresponding to the first detection task and a second feature map corresponding to the second detection task, and the end-layer network module 2006 performs an object detection for the first detection task and a point detection for the second detection task according to the feature maps.

FIG. 4 is a schematic diagram illustrating feature maps obtained for different detection tasks according to an exemplary embodiment of the disclosure.

Referring to FIG. 4, after inputting the input image 312 to the backbone architecture module 2004, the processor 140 can obtain first feature maps 420-1, 420-2 and 420-3 of the first detection task and a second feature map 430 of the second detection task from a single convolutional neural network 410 configured in the backbone architecture module 2004, In particular, the processor 140 can use the backbone architecture module 2004 having the convolution layers to extract a shared feature of the first feature maps 420-1, 420-2 and 420-3 of the first detection task and the second feature map 430 of the second detection task from the image to be recognized (e.g., the input image 312), and to accordingly generate a shared feature map of the first feature maps 420-1, 420-2 and 420-3 of the first detection task and the second feature map 430 of the second detection task.

For example, in this exemplary embodiment, because the first detection task is the 2D object detection task, the first feature map of the first detection task can include coordinates of a bounding box, a width and a height of the bounding box, a detection confidence level of the bounding box and a class probability of the bounding box. Because the second detection task is the image segmentation detection task, the second feature map of the second detection task can include the coordinates of the bounding box, the detection confidence level of the bounding box and the class probability of the bounding box.

Referring to FIG. 2, the computer vision processing module 2008 is configured to perform the point detection according to information of the feature map. Specifically, in order to perform an image segmentation detection correctly, in this exemplary embodiment, the processor 140 runs the computer vision processing module 2008 to perform a computer vision-based processing according to information of the second feature map of the second detection task.

FIG. 5 is a schematic diagram illustrating a grid map obtained by using a computer vision technique according to an exemplary embodiment of the disclosure.

Referring to FIG. 5, the computer vision processing module 2008 can obtain a corresponding image segmentation ground truth (i.e., an image segmentation ground truth 510) from the input image (i.e., the input image 312) according to the feature map generated by the backbone architecture module 2004.

As shown in FIG. 5, the image segmentation ground truth 510 includes points GS₀, GS₁, GS₂, GS₃, GS₄, GS₅, GS₆ and GS₇. It is assumed that the dimensions of the neural network model include the width W_(M) and the height H_(M), and γ is a scaler of a cell map. In a grid map 520, cells including the points GS₀, GS₁, GS₂, GS₃, GS₄, GS₅, GS₆ and GS₇ may be regarded as positive data, and cells not including the points GS₀, GS₁, GS₂, GS₃, GS₄, GS₅, GS₆ and GS₇ may be temporarily regarded as negative data. Next, by using the Formula 2 and Formula 3 below, the computer vision processing module 2008 can calculate a vector analysis between neighboring points GS_(n) and GS_(n+1).

$\begin{matrix} {{\Delta x} = \frac{{G{S_{n + 1}(x)}} - {G{S_{n}(x)}}}{\sqrt{\begin{matrix} {\left( {{G{S_{n + 1}(x)}} + {G{S_{n}(x)}}} \right)^{2} +} \\ \left( {{G{S_{n + 1}(y)}} + {G{S_{n}(y)}}} \right)^{2} \end{matrix}}}} & \left( {{Formula}2} \right) \end{matrix}$ $\begin{matrix} {{\Delta y} = \frac{{G{S_{n + 1}(y)}} - {G{S_{n}(y)}}}{\sqrt{\begin{matrix} {\left( {{G{S_{n + 1}(x)}} + {G{S_{n}(x)}}} \right)^{2} +} \\ \left( {{G{S_{n + 1}(y)}} + {G{S_{n}(y)}}} \right)^{2} \end{matrix}}}} & \left( {{Formula}3} \right) \end{matrix}$

After calculating the vector analysis between the neighboring points GS_(n) and GS_(n+1), the processor 140 can repeatedly execute GS_(n)=GS_(N)+Δxy on each GS_(n)≤GS_(n+1) and convert all points that first encounter negative cell data to the positive data. In this way, the processor 140 can obtain a positive data grid map 520 from the image segmentation ground truth 510. That is, the positive data grid map 520 with all cells including the points GS₀, GS₁, GS₂, GS₃, GS₄, GS₅, GS₆ and GS₇ may be obtained.

FIG. 6 is a schematic diagram illustrating a first feature map and a second feature map according to an exemplary embodiment of the disclosure.

Referring to FIG. 6, the second feature map (point candidates RS⁰(x, y, cl, p)) may include coordinates (x, y) of a bounding box, a detection confidence level cl of the bounding box and a class probability p of the bounding box. The first feature map (detection box candidates RD⁰(x, y, w, h, cl, p)) may include the coordinates (x, y) of the bounding box, a width w and a height h of the bounding box, the detection confidence level cl of the bounding box and the class probability p of the bounding box. After the point candidates RS⁰(x, y, cl, p) and the detection box candidates RD⁰(x, y, w, h, cl, p) are arranged into an array as shown in FIG. 6, a non maximum suppression (NMS) technique may be used to remove the point candidates and detection box candidates with low confidence levels. In this way, point predictions (RS(x, y, c, cl, p)) and detection box predictions (RD(x, y, w, h, c, cl, p)) may be generated.

In an exemplary embodiment, a first loss function may be configured for the first detection task, and a second loss function may be configured for the second detection task. The first loss function is configured to measure an error between a first recognition result and a first reference result corresponding to the first detection task, and the second loss function is configured to measure an error between a second recognition result and a second reference result corresponding to the second detection task.

FIG. 7 is a schematic diagram illustrating inputs for a first loss function according to an exemplary embodiment of the disclosure.

According to the image segmentation ground truth 510 (i.e., GS(x,y,c)) and the point predictions RS(x, y, c, cl, p) generated by the method shown in FIG. 6, The first loss function (a segmentation loss Seg_(loss)) can measure the error between the first recognition result (the point predictions RS(x, y, c, cl, p)) and the first reference result (the image segmentation ground truth 510, i.e., GS(x,y,c)) corresponding to the first detection task. Seg_(loss) may be obtained through Formula 4 to Formula 7 below.

xy l ⁢ o ⁢ s ⁢ s s ⁢ e ⁢ q = λ ⁢ pt ⁢ ∑ γ ⁢ w M × γ ⁢ H M i = 0 i p ⁢ t ( ( R ⁢ S i ( x ) - G ⁢ S i ( x ) ) 2 + ( R ⁢ S i ( y ) - G ⁢ S i ( y ) ) 2 ) ( Formula ⁢4 ) c l ⁢ o ⁢ s ⁢ s s ⁢ e ⁢ q = ∑ γ ⁢ w M × γ ⁢ H M i = 0 i p ⁢ t ( ∑ c ∈ classes   ( R ⁢ S i ( p ⁡ ( c ) ) - G ⁢ S i ( p ⁡ ( c ) ) ) 2 ) ( Formula ⁢ 5 ) c ⁢ l l ⁢ o ⁢ s ⁢ s s ⁢ e ⁢ q = ∑ γ ⁢ w M × γ ⁢ H M i = 0 i p ⁢ t ( ( R ⁢ S i ( c ⁢ l ) - G ⁢ S i ( c ⁢ l ) ) 2 + λ ⁢ nopt ⁢ ∑ γ ⁢ w M × γ ⁢ H M i = 0 i p ⁢ t ( ( R ⁢ S i ( c ⁢ l ) - GS i ( c ⁢ l ) ) 2 ) ( Formula ⁢ 6 ) $\begin{matrix} {{Seg}_{loss} = \frac{{\underset{f}{\Sigma}{{xy}_{loss}^{seg}(f)}} + {c_{loss}^{seg}(f)} + {c{l_{loss}^{seg}(f)}}}{mf}} & \left( {{Formula}7} \right) \end{matrix}$ wherein λpt denotes a normalization weight for a positive xy-prediction;

_(i) ^(pt) denotes a positive point prediction; λnopt denotes a normalization weight for a negative (null value) xy-prediction;

_(i) ^(nopt) denotes a negative point prediction; GS_(i)(cl)=1; GS_(i)(p(c))=1; mf denotes a batch number; f denotes a frame index.

FIG. 8 is a schematic diagram illustrating inputs for a second loss function according to an exemplary embodiment of the disclosure.

The backbone architecture module 2004 of the processor 140 can obtain a 2D ground truth 810 from the input image (e.g., the input image 312). According to the 2D ground truth 810 (i.e., GD(x, y, w, h, c)) and the detection box predictions RD(x, y, w, h, c, cl, p)) generated by the method shown by FIG. 6, the second loss function (a 2D object detection loss Obj_(loss)) can measure an error between the second recognition result (the detection box predictions RD(x, y, w, h, c, cl, p) and the second recognition result (the 2D ground truth 810, i.e., GD(x, y, w, h, c)) corresponding to the second detection task. Obj_(loss) may be obtained through Formula 8 to Formula 12 below.

xy l ⁢ o ⁢ s ⁢ s 2 ⁢ D = λ ⁢ xy ⁢ ∑ γ ⁢ w M × γ ⁢ H M i = 0 ∑ j = 0 A i ⁢ j b ⁢ b ( ( R ⁢ D i ( x ) - G ⁢ D i ( x ) ) 2 + ( ( R ⁢ D i ( y ) - G ⁢ D i ( y ) ) 2 ) ( Formula ⁢ 8 ) wh l ⁢ o ⁢ s ⁢ s 2 ⁢ D = λ ⁢ x ⁢ y ⁢ ∑ γ ⁢ w M × γ ⁢ H M i = 0 ∑ j = 0 A i ⁢ j b ⁢ b ( ( R ⁢ D i ( w ) - G ⁢ D i ( w ) ) 2 + ( R ⁢ D i ( h ) - G ⁢ D i ( h ) ) 2 ) ( Formula ⁢ 9 ) c l ⁢ o ⁢ s ⁢ s 2 ⁢ D = ∑ γ ⁢ w M × γ ⁢ H M i = 0 i ⁢ j b ⁢ b ( ∑ c ∈ c ⁢ l ⁢ a ⁢ s ⁢ ses   ( R ⁢ D i ( p ⁡ ( c ) ) - G ⁢ D i ( p ⁡ ( c ) ) ) 2 ) ( Formula ⁢ 10 ) cl l ⁢ o ⁢ s ⁢ s 2 ⁢ D = ∑ γ ⁢ w M × γ ⁢H M i = 0 ∑ j = 0 A i ⁢ j bb ( ( R ⁢ D i ( c ⁢ l ) - G ⁢ D i ( c ⁢ l ) ) 2 + λ ⁢ nobb ⁢ ∑ γ ⁢ w M × γ ⁢ H M i = 0 ∑ j = 0 A i ⁢ j n ⁢ o ⁢ b ⁢ b ( ( R ⁢ D i ( c ⁢ l ) - G ⁢ D i ( c ⁢ l ) ) 2 ) ) ( Formula ⁢ 11 ) $\begin{matrix} {{Obj}_{loss} = \frac{\begin{matrix} {{\underset{f}{\Sigma}x{y_{loss}^{2D}(f)}} + {wh_{loss}^{2D}(f)} +} \\ {{c_{loss}^{2D}(f)} + {c{l_{loss}^{2D}(f)}}} \end{matrix}}{mf}} & \left( {{Formula}12} \right) \end{matrix}$ wherein λxy denotes a normalization weight for a positive xy-prediction;

_(i,j) ^(bb) denotes a positive detection prediction; λnobb denotes a normalization weight for a negative (null value) xy-prediction;

_(i,j) ^(nobb) denotes a negative detection prediction; GD_(i)(a) is 1; GD_(i)(p(c)) is 1; A denotes a total number of boxes; mf denotes a batch number; f denotes a frame index.

In an exemplary embodiment, the processor 140 can configure a plurality of prediction layers in the end-layer network module 2006, and process the shared feature map according to the first loss function corresponding to the first detection task and the second loss function corresponding to the second detection task. In other words, after the processor 140 extracts the shared feature from the image to be recognized (the input image 312) and generates the shared feature map of the first feature maps 420-1, 420-2 and 420-3 and the second feature map 430 through the backbone architecture module 2004, the processor 140 can process the shared feature map according to the first loss function corresponding to the first detection task obtained from Formulas 4 to 7 above and the second loss function corresponding to the second detection task obtained from Formulas 8 to 12 above.

In an exemplary embodiment, the processor 140 can use a plurality of normalization weights to balance a range of loss values of the second detection task to adjust a learnable weight of the backbone architecture module with reference to a range of loss values of the first detection task. For example, after the first loss function (the segmentation loss Seg_(loss)) and the second loss function (the 2D object detection loss Obj_(loss)) are obtained, a combined loss Final_(loss) may be obtained by using Formula 13 below. The processor 140 can use the combined loss Final_(loss) to adjust a learnable weight of the backbone architecture module 2004.

$\begin{matrix} {{{Final_{loss}} = {{{Ob}j_{loss}} + {\frac{Seg_{loss}}{R}{wherein}}}}{{R = \frac{\begin{matrix} \min \\ f \end{matrix}{{Seg}_{loss}(f)}}{\begin{matrix} \min \\ f \end{matrix}{{Obj}_{loss}(f)}}};{\begin{matrix} \min \\ f \end{matrix}{{Seg}_{loss}(f)}}}} & \left( {{Formula}13} \right) \end{matrix}$ denotes a minimum segmentation loss when the backbone architecture module 2004 was trained only with the image segmentation detection task;

$\begin{matrix} \min \\ f \end{matrix}{{Obj}_{loss}(f)}$ denotes a minimum 2D object detection loss when the backbone architecture module was trained only with the 2D object detection task.

In an exemplary embodiment, the processor 140 can use a computer vision technique in the end-layer network module to cluster and connect the recognition result corresponding to the second detection task.

FIG. 9A to FIG. 9D are schematic diagrams illustrating a segmentation map obtained by using a computer vision technique according to an exemplary embodiment of the disclosure.

Referring to FIG. 9A, it is assumed that point candidates RS⁰(x, y, cl, p) obtained by the method shown in FIG. 6 are point candidates 910 in FIG. 9; the second feature map 430 of the second detection task (the image segmentation) obtain by the method shown in FIG. 4 is a feature map 920 in FIG. 9; and the positive data grid map 520 obtained by the method shown in FIG. 5 is a positive data grid map 930 in FIG. 9. In this exemplary embodiment, the processor 140 can use the computer vision technique to obtain a segmentation map by using the point candidates 910, the feature map 920 and the positive data grid map 930.

In this exemplary embodiment, the operation in which the processor 140 uses the computer vision technique to obtain the segmentation map can be divided into three stages. In the first stage, the processor 140 can recognize a start point st_(pt) and an end point ed_(pt) by using Formula 14 and Formula 15 below.

st pt = ( min b b pt Q b ( u ) , max a a pt Q a ( v ) ) ( Formula ⁢ 14 ) e ⁢ d p ⁢ t = ( max b b pt Q b ( u ) , max a a pt Q a ( v ) ) ( Formula ⁢ 15 ) wherein

_(a) ^(pt) denotes positive point predictions, and

_(b) ^(pt) denotes bottom positive point predictions.

In the second stage, the processor 140 continues to find out an order index of the points.

FIG. 9B is a schematic diagram illustrating the second stage for obtaining the segmentation map by using the computer vision technique according to an exemplary embodiment of the disclosure.

Referring to FIG. 9B, it is assumed that the start point st_(pt) obtained in the first stage is a point 910-1, and the end point ed_(pt) obtained in the first stage is a point 910-2. The implementation of the second stage is that, starting from the start point st_(pt) (the point 910-1), a kernel can search whether there are positive cells in the neighboring cells in the positive data grid map 930. Here, the kernel may be a kernel 940 with both length and width being 3 in FIG. 9B, and the Formula 16 and Formula 17 below are used to determine the order index.

$\begin{matrix} {{Q\left( {u_{origin}\ ,v_{origin}} \right)} = 0} & \left( {{Formula}16} \right) \end{matrix}$ $\begin{matrix} {\begin{matrix} \max \\ {{{- 1} \leq i},{j \leq 1}} \end{matrix}{k_{n}\left( {i,j} \right)} \times {Q\left( {{u + i},{v + i}} \right)}} & \left( {{Formula}17} \right) \end{matrix}$

Starting from the point 910-1, the kernel searches whether there are the positive cells in the neighboring cells in the positive data grid map 930. Here, the kernel may be a kernel 940 with both length and width being 3 in FIG. 9B, and the Formula 16 and Formula 17 below are used to determine the order index.

When the neighboring positive cells cannot be found in the positive data grid map 930 by using the kernel 940 (i.e., K_(n)), another kernel 950 with both length and width being 5 (K_(gap)) may be used to search the neighboring cells in the feature map 920 and the positive data grid map 930, and such operation can be expressed by Formula 18 to Formula 20 below.

$\begin{matrix} {{{Q\left( {u_{origin}\ ,v_{origin}} \right)} = 0},{{F_{3}\left( {u_{origin}\ ,v_{origin}} \right)} = 0}} & \left( {{Formula}18} \right) \end{matrix}$ $\begin{matrix} {{Situation}1} &  \end{matrix}$ max - 2 ≤ i , j ≤ 2 ⁢ Q ⁡ ( u + i ,   v + i ) > 0 ⁢ min - 2 ≤ i , j ≤ 2 - 2 ≤ i , j ≤ 2 pt ( Q ⁡ ( u + i ) - Q ⁡ ( u ) ) 2 + ( Q ⁡ ( v + j ) - Q ⁡ ( v ) ) 2 ( Formula ⁢ 19 ) $\begin{matrix} {{Situation}2} &  \end{matrix}$ $\begin{matrix} {{{\begin{matrix} \max \\ {{{- 2} \leq i},{j \leq 2}} \end{matrix}{Q\left( {{u + i},\ {v + i}} \right)}} = 0}{\begin{matrix} \max \\ {{{- 2} \leq i},{j \leq 2}} \end{matrix}{F_{3}\left( {{u + i},{v + i}} \right)}}} & \left( {{Formula}20} \right) \end{matrix}$

After the second stage is processed, the sorted points may then be used to draw a contour as shown in FIG. 9D to obtain the second recognition result (i.e., an image segmentation result) corresponding to the second detection task (the image segmentation) of the image to be recognized.

FIG. 10 is a flowchart illustrating an image recognition method according to an exemplary embodiment of the disclosure.

Referring to FIG. 10, in step S1010, the image sensor 110 obtains an image to be recognized.

In step S1020, the processor 140 performs a preprocessing on the image.

In step S1030, the processor 140 can input the image to be recognized (i.e., the input image 312 or the input image 322 in FIG. 3) to a single convolutional neural network. Here, the single convolutional neural network is, for example, the neural network algorithm YOLOv3 (You only look once version 3, YOLO version 3) for image recognition. However, the disclosure does not limit the type of single convolutional neural network used.

Next, in step S1040, the processor 140 obtains a first feature map belonging to a first detection task and a second feature map belonging to a second detection task according to the single convolutional neural network.

In step S1050, the processor 140 can generate a first recognition result (i.e., a 2D object detection result) corresponding to the first detection task (a 2D object detection) from the image to be recognized according to the first feature map (the first feature maps 420-1, 420-2 and 420-3), and generate a second recognition result (i.e., the image segmentation result) corresponding to the second detection task (the image segmentation) from the image to be recognized according to the second feature map (the second feature map 430).

In step S1060, the output device 130 outputs the first recognition result (i.e., the 2D object detection result) corresponding to the first detection task (the 2D object detection) and the second recognition result (i.e., the image segmentation result) corresponding to the second detection task (i.e., the image segmentation).

In summary, the image recognition method and system of the exemplary embodiments of the disclosure can obtain the recognition results of different detection tasks simply by using the single convolutional neural network when there is the shared feature between the feature maps of the different detection tasks. Based on this, the time required for the image recognition can be saved and the accuracy of image recognition can be improved.

Although the present disclosure has been described with reference to the above embodiments, it is apparent to one of the ordinary skill in the art that modifications to the described embodiments may be made without departing from the spirit of the present disclosure. Accordingly, the scope of the present disclosure will be defined by the attached claims not by the above detailed descriptions. 

The invention claimed is:
 1. An image recognition method for a plurality of detection tasks, the image recognition method comprising: obtaining an image to be recognized by an image sensor; inputting the image to be recognized to a single convolutional neural network; obtaining a first feature map belonging to a first detection task and a second feature map belonging to a second detection task according to an output result of the single convolutional neural network, wherein the first feature map and the second feature map have a shared feature; using an end-layer network module to generate a first recognition result corresponding to the first detection task from the image to be recognized according to the first feature map, and to generate a second recognition result corresponding to the second detection task from the image to be recognized according to the second feature map, wherein the end-layer network module uses a computer vision technique to obtain the second recognition result according to the second feature map; and outputting the first recognition result corresponding to the first detection task and the second recognition result corresponding to the second detection task.
 2. The image recognition method of claim 1, wherein the first detection task is a 2D object detection, and the second detection task is an image segmentation.
 3. The image recognition method of claim 1, further comprising: configuring a backbone architecture module having a plurality of convolution layers in the single convolutional neural network; and using the backbone architecture module to extract the shared feature from the image to be recognized, and to generate a shared feature map.
 4. The image recognition method of claim 3, further comprising: configuring a first loss function for the first detection task, and configuring a second loss function for the second detection task, wherein the first loss function measures an error between the first recognition result and a first reference result corresponding to the first detection task, wherein the second loss function measures an error between the second recognition result and a second reference result corresponding to the second detection task.
 5. The image recognition method of claim 4, further comprising: configuring a plurality of prediction layers in the end-layer network module, and processing the shared feature map according to the first loss function corresponding to the first detection task and the second loss function corresponding to the second detection task.
 6. The image recognition method of claim 4, further comprising: using a plurality of normalization weights to balance a range of loss values of the second detection task to adjust a learnable weight of the backbone architecture module with reference to a range of loss values of the first detection task.
 7. The image recognition method of claim 1, further comprising using the computer vision technique in the end-layer network module to cluster and connect the second recognition result corresponding to the second detection task.
 8. The image recognition method of claim 1, wherein the first feature map of the first detection task comprises coordinates of a bounding box, a width and a height of the bounding box, a detection confidence level of the bounding box and a class probability of the bounding box, and the second feature map of the second detection task comprises the coordinates of the bounding box, the detection confidence level of the bounding box and the class probability of the bounding box.
 9. An image recognition system, comprising: an image sensor, obtaining an image to be recognized; a storage device; an output device; and a processor, coupled to the image sensor, the storage device and the output device, wherein the processor inputs the image to be recognized to a single convolutional neural network, wherein the storage device stores the single convolutional neural network, wherein the processor obtains a first feature map belonging to a first detection task and a second feature map belonging to a second detection task according to an output result of the single convolutional neural network, wherein the first feature map and the second feature map have a shared feature, wherein the processor uses an end-layer network module to generate a first recognition result corresponding to the first detection task from the image to be recognized according to the first feature map, and to generate a second recognition result corresponding to the second detection task from the image to be recognized according to the second feature map, wherein the processor uses the end-layer network module to use a computer vision technique to obtain the second recognition result according to the second feature map, wherein the output device outputs the first recognition result corresponding to the first detection task and the second recognition result corresponding to the second detection task.
 10. The image recognition system of claim 9, wherein the first detection task is a 2D object detection, and the second detection task is an image segmentation.
 11. The image recognition system of claim 9, wherein the processor configures a backbone architecture module having a plurality of convolution layers in the single convolutional neural network, wherein the processor uses the backbone architecture module to extract the shared feature from the image to be recognized, and to generate a shared feature map.
 12. The image recognition system of claim 11, wherein the processor configures a first loss function for the first detection task, and configures a second loss function for the second detection task, wherein the first loss function measures an error between the first recognition result and a first reference result corresponding to the first detection task, wherein the second loss function measures an error between the second recognition result and a second reference result corresponding to the second detection task.
 13. The image recognition system of claim 12, wherein the processor configures a plurality of prediction layers in the end-layer network module, and processes the shared feature map according to the first loss function corresponding to the first detection task and the second loss function corresponding to the second detection task.
 14. The image recognition system of claim 12, wherein the processor uses a plurality of normalization weights to balance a range of loss values of the second detection task to adjust a learnable weight of the backbone architecture module with reference to a range of loss values of the first detection task.
 15. The image recognition system of claim 9, wherein the processor uses the computer vision technique in the end-layer network module to cluster and connect the second recognition result corresponding to the second detection task.
 16. The image recognition system of claim 9, wherein the first feature map of the first detection task comprises coordinates of a bounding box, a width and a height of the bounding box, a detection confidence level of the bounding box and a class probability of the bounding box, and the second feature map of the second detection task comprises the coordinates of the bounding box, the detection confidence level of the bounding box and the class probability of the bounding box. 